package com.peng._05weibo.pojo.dto;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;

/**
 * 用户注册DTO
 *
 * @Author peng
 * @Date 2024-04-23 14:14
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class UserRegDTO {
    @ApiModelProperty(value = "用户昵称")
    private String nickname;

    @ApiModelProperty(value = "用户密码", required = true, example = "123456")
    @NotNull(message = "密码不能为空")
    @Pattern(regexp = "^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,20}$", message = "密码必须包含字母和数字，且长度为6-20")
    private String password;

    @ApiModelProperty(value = "用户名", required = true)
    @NotNull(message = "用户名不能为空")
    @Size(min = 3, max = 20, message = "用户名长度为3-20")
    private String username;
}
